import { useTodoStore } from '@/stores/todo'
import { storeToRefs } from 'pinia'

export function useTodo() {
  const { todos, filter, filteredTodos, totalCount, activeCount, completedCount } =
    storeToRefs(useTodoStore())
  const { addTodo, removeTodo, toggleTodo, updateTodo, clearCompleted, setFilter } = useTodoStore()

  return {
    todos,
    filter,
    filteredTodos,
    totalCount,
    activeCount,
    completedCount,
    addTodo,
    removeTodo,
    toggleTodo,
    updateTodo,
    clearCompleted,
    setFilter,
  }
}
